package com.ruoyi.workbench.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.workbench.domain.WorkFile;
import com.ruoyi.workbench.mapper.WorkFileMapper;
import com.ruoyi.workbench.service.IWorkFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 附件Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-07-02
 */
@Service
public class WorkFileServiceImpl implements IWorkFileService
{
    @Autowired
    private WorkFileMapper workFileMapper;

    /**
     * 查询附件
     * 
     * @param sid 附件主键
     * @return 附件
     */
    @Override
    public WorkFile selectWorkFileBySid(Integer sid)
    {
        return workFileMapper.selectWorkFileBySid(sid);
    }

    /**
     * 查询附件列表
     * 
     * @param workFile 附件
     * @return 附件
     */
    @Override
    public List<WorkFile> selectWorkFileList(WorkFile workFile)
    {
        return workFileMapper.selectWorkFileList(workFile);
    }

    /**
     * 新增附件
     * 
     * @param workFile 附件
     * @return 结果
     */
    @Override
    public int insertWorkFile(WorkFile workFile)
    {
        workFile.setCreateTime(DateUtils.getNowDate());
        return workFileMapper.insertWorkFile(workFile);
    }

    /**
     * 修改附件
     * 
     * @param workFile 附件
     * @return 结果
     */
    @Override
    public int updateWorkFile(WorkFile workFile)
    {
        workFile.setUpdateTime(DateUtils.getNowDate());
        return workFileMapper.updateWorkFile(workFile);
    }

    /**
     * 批量删除附件
     * 
     * @param sids 需要删除的附件主键
     * @return 结果
     */
    @Override
    public int deleteWorkFileBySids(Integer[] sids)
    {
        return workFileMapper.deleteWorkFileBySids(sids);
    }

    /**
     * 删除附件信息
     * 
     * @param sid 附件主键
     * @return 结果
     */
    @Override
    public int deleteWorkFileBySid(Integer sid)
    {
        return workFileMapper.deleteWorkFileBySid(sid);
    }
}
